﻿ 
using System;
using System.Linq;
using System.ComponentModel.DataAnnotations;
using MoneyBook.Assets.Resources;
using MoneyBook.ComponentModel;
using MoneyBook.Web.Models;
using MoneyBook.Web.Services;
using System.ServiceModel.DomainServices.Client;
using System.Collections.Generic;
using System.Reactive.Subjects;
using System.Reactive.Linq;
using System.Collections.ObjectModel;
using MoneyBook.Reflection;
using MoneyBook.Web.Assets.Resources;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.ServiceModel.DomainServices.Client.ApplicationServices;
using MoneyBook.Windows;

namespace MoneyBook.DialogViews {

	public partial class CreateNewAccountDialogModel : MoneyBook.ViewModelBase {
		
		[System.ComponentModel.DataAnnotations.CustomValidationAttribute(typeof(CreateNewAccountDialogModel), "ValidateNewAccountNameAlreadyExist")]
		public System.String AccountName {
			get { return accountName_; }
			set {
				if( this.accountName_ != value){
					bool cancel = false;
					System.String oldValue = this.accountName_;
                    PreAccountNameChange(value, this.accountName_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("AccountName");
					this.accountName_ = value;
					this.OnPropertyChanged("AccountName");

					this.ValidateProperty("AccountName", this.accountName_);
					PostAccountNameChange(value, oldValue);
				}
			}
		}
		
		partial void PreAccountNameChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostAccountNameChange(System.String newValue, System.String oldValue);

		public System.String Description {
			get { return description_; }
			set {
				if( this.description_ != value){
					bool cancel = false;
					System.String oldValue = this.description_;
                    PreDescriptionChange(value, this.description_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("Description");
					this.description_ = value;
					this.OnPropertyChanged("Description");

					this.ValidateProperty("Description", this.description_);
					PostDescriptionChange(value, oldValue);
				}
			}
		}
		
		partial void PreDescriptionChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostDescriptionChange(System.String newValue, System.String oldValue);

	}

	public partial class CreateNewAccountItemDialogModel : MoneyBook.ViewModelBase {
		
		[MoneyBook.ComponentModel.ExcludeValidationAttribute()]
		public MoneyBook.Web.Models.Account TargetAccount {
			get { return targetAccount_; }
			set {
				if( this.targetAccount_ != value){
					bool cancel = false;
					MoneyBook.Web.Models.Account oldValue = this.targetAccount_;
                    PreTargetAccountChange(value, this.targetAccount_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("TargetAccount");
					this.targetAccount_ = value;
					this.OnPropertyChanged("TargetAccount");

					this.ValidateProperty("TargetAccount", this.targetAccount_);
					PostTargetAccountChange(value, oldValue);
				}
			}
		}
		
		partial void PreTargetAccountChange(MoneyBook.Web.Models.Account newValue, MoneyBook.Web.Models.Account currentValue, ref bool cancel);
		
		partial void PostTargetAccountChange(MoneyBook.Web.Models.Account newValue, MoneyBook.Web.Models.Account oldValue);

		[MoneyBook.Reflection.MapEnhancePropertyAttributePropertiesAttribute("Category", "CategoryId")]
		public MoneyBook.Web.Models.Category SelectedCategory {
			get { return selectedCategory_; }
			set {
				if( this.selectedCategory_ != value){
					bool cancel = false;
					MoneyBook.Web.Models.Category oldValue = this.selectedCategory_;
                    PreSelectedCategoryChange(value, this.selectedCategory_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("SelectedCategory");
					this.selectedCategory_ = value;
					this.OnPropertyChanged("SelectedCategory");

					this.ValidateProperty("SelectedCategory", this.selectedCategory_);
					PostSelectedCategoryChange(value, oldValue);
				}
			}
		}
		
		partial void PreSelectedCategoryChange(MoneyBook.Web.Models.Category newValue, MoneyBook.Web.Models.Category currentValue, ref bool cancel);
		
		partial void PostSelectedCategoryChange(MoneyBook.Web.Models.Category newValue, MoneyBook.Web.Models.Category oldValue);

		public System.Nullable<System.DateTime> PurchaseDate {
			get { return purchaseDate_; }
			set {
				if( this.purchaseDate_ != value){
					bool cancel = false;
					System.Nullable<System.DateTime> oldValue = this.purchaseDate_;
                    PrePurchaseDateChange(value, this.purchaseDate_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("PurchaseDate");
					this.purchaseDate_ = value;
					this.OnPropertyChanged("PurchaseDate");

					this.ValidateProperty("PurchaseDate", this.purchaseDate_);
					PostPurchaseDateChange(value, oldValue);
				}
			}
		}
		
		partial void PrePurchaseDateChange(System.Nullable<System.DateTime> newValue, System.Nullable<System.DateTime> currentValue, ref bool cancel);
		
		partial void PostPurchaseDateChange(System.Nullable<System.DateTime> newValue, System.Nullable<System.DateTime> oldValue);

		public System.String Abstract {
			get { return abstract_; }
			set {
				if( this.abstract_ != value){
					bool cancel = false;
					System.String oldValue = this.abstract_;
                    PreAbstractChange(value, this.abstract_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("Abstract");
					this.abstract_ = value;
					this.OnPropertyChanged("Abstract");

					this.ValidateProperty("Abstract", this.abstract_);
					PostAbstractChange(value, oldValue);
				}
			}
		}
		
		partial void PreAbstractChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostAbstractChange(System.String newValue, System.String oldValue);

		public System.Nullable<System.Int64> Expense {
			get { return expense_; }
			set {
				if( this.expense_ != value){
					bool cancel = false;
					System.Nullable<System.Int64> oldValue = this.expense_;
                    PreExpenseChange(value, this.expense_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("Expense");
					this.expense_ = value;
					this.OnPropertyChanged("Expense");

					this.ValidateProperty("Expense", this.expense_);
					PostExpenseChange(value, oldValue);
				}
			}
		}
		
		partial void PreExpenseChange(System.Nullable<System.Int64> newValue, System.Nullable<System.Int64> currentValue, ref bool cancel);
		
		partial void PostExpenseChange(System.Nullable<System.Int64> newValue, System.Nullable<System.Int64> oldValue);

	}

}

namespace MoneyBook.Views {

	public partial class CreateUserViewModel : MoneyBook.ViewModelBase {
		
		public System.String MemberName {
			get { return memberName; }
			set {
				if( this.memberName != value){
					bool cancel = false;
					System.String oldValue = this.memberName;
                    PreMemberNameChange(value, this.memberName, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("MemberName");
					this.memberName = value;
					this.OnPropertyChanged("MemberName");

					this.ValidateProperty("MemberName", this.memberName);
					PostMemberNameChange(value, oldValue);
				}
			}
		}
		
		partial void PreMemberNameChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostMemberNameChange(System.String newValue, System.String oldValue);

		public System.String DisplayName {
			get { return displayName; }
			set {
				if( this.displayName != value){
					bool cancel = false;
					System.String oldValue = this.displayName;
                    PreDisplayNameChange(value, this.displayName, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("DisplayName");
					this.displayName = value;
					this.OnPropertyChanged("DisplayName");

					this.ValidateProperty("DisplayName", this.displayName);
					PostDisplayNameChange(value, oldValue);
				}
			}
		}
		
		partial void PreDisplayNameChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostDisplayNameChange(System.String newValue, System.String oldValue);

		public System.String Password {
			get { return password; }
			set {
				if( this.password != value){
					bool cancel = false;
					System.String oldValue = this.password;
                    PrePasswordChange(value, this.password, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("Password");
					this.password = value;
					this.OnPropertyChanged("Password");

					this.ValidateProperty("Password", this.password);
					PostPasswordChange(value, oldValue);
				}
			}
		}
		
		partial void PrePasswordChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostPasswordChange(System.String newValue, System.String oldValue);

		[System.ComponentModel.DataAnnotations.DisplayAttribute(Name = "RePassword", ResourceType = typeof(Strings))]
		[MoneyBook.Reflection.MapEnhancePropertyAttributePropertiesAttribute("Password")]
		[System.ComponentModel.DataAnnotations.CustomValidationAttribute(typeof(CreateUserViewModel), "ValidateRePassowrdDifference")]
		public System.String RePassword {
			get { return rePassword; }
			set {
				if( this.rePassword != value){
					bool cancel = false;
					System.String oldValue = this.rePassword;
                    PreRePasswordChange(value, this.rePassword, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("RePassword");
					this.rePassword = value;
					this.OnPropertyChanged("RePassword");

					this.ValidateProperty("RePassword", this.rePassword);
					PostRePasswordChange(value, oldValue);
				}
			}
		}
		
		partial void PreRePasswordChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostRePasswordChange(System.String newValue, System.String oldValue);

	}

	public partial class LoginViewModel : MoneyBook.ViewModelBase {
		
		[MoneyBook.Reflection.ExcludeEnhancePropertyAttributeTypesAttribute(typeof(StringLengthAttribute))]
		public System.String MemberName {
			get { return memberName_; }
			set {
				if( this.memberName_ != value){
					bool cancel = false;
					System.String oldValue = this.memberName_;
                    PreMemberNameChange(value, this.memberName_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("MemberName");
					this.memberName_ = value;
					this.OnPropertyChanged("MemberName");

					this.ValidateProperty("MemberName", this.memberName_);
					PostMemberNameChange(value, oldValue);
				}
			}
		}
		
		partial void PreMemberNameChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostMemberNameChange(System.String newValue, System.String oldValue);

		[MoneyBook.Reflection.ExcludeEnhancePropertyAttributeTypesAttribute(typeof(StringLengthAttribute))]
		public System.String Password {
			get { return password_; }
			set {
				if( this.password_ != value){
					bool cancel = false;
					System.String oldValue = this.password_;
                    PrePasswordChange(value, this.password_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("Password");
					this.password_ = value;
					this.OnPropertyChanged("Password");

					this.ValidateProperty("Password", this.password_);
					PostPasswordChange(value, oldValue);
				}
			}
		}
		
		partial void PrePasswordChange(System.String newValue, System.String currentValue, ref bool cancel);
		
		partial void PostPasswordChange(System.String newValue, System.String oldValue);

	}

	public partial class MainViewModel : MoneyBook.ViewModelBase {
		
		[MoneyBook.ComponentModel.ExcludeValidationAttribute()]
		public System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Account> Accounts {
			get { return accounts_; }
			set {
				if( this.accounts_ != value){
					bool cancel = false;
					System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Account> oldValue = this.accounts_;
                    PreAccountsChange(value, this.accounts_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("Accounts");
					this.accounts_ = value;
					this.OnPropertyChanged("Accounts");

					this.ValidateProperty("Accounts", this.accounts_);
					PostAccountsChange(value, oldValue);
				}
			}
		}
		
		partial void PreAccountsChange(System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Account> newValue, System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Account> currentValue, ref bool cancel);
		
		partial void PostAccountsChange(System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Account> newValue, System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Account> oldValue);

		[MoneyBook.ComponentModel.ExcludeValidationAttribute()]
		public System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Item> Items {
			get { return items_; }
			set {
				if( this.items_ != value){
					bool cancel = false;
					System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Item> oldValue = this.items_;
                    PreItemsChange(value, this.items_, ref cancel);
                    if(cancel){
                        return;
                    }
					this.OnPropertyChanging("Items");
					this.items_ = value;
					this.OnPropertyChanged("Items");

					this.ValidateProperty("Items", this.items_);
					PostItemsChange(value, oldValue);
				}
			}
		}
		
		partial void PreItemsChange(System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Item> newValue, System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Item> currentValue, ref bool cancel);
		
		partial void PostItemsChange(System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Item> newValue, System.Collections.ObjectModel.ObservableCollection<MoneyBook.Web.Models.Item> oldValue);

	}

}


